package com.kgcx.coupon.controller;
import com.kgcx.common.bean.ReturnData;
import com.kgcx.common.controller.BaseController;
import com.kgcx.coupon.domain.UserRelation;
import com.kgcx.coupon.dto.UserRelationDto;
import com.kgcx.coupon.service.UserPullNewService;
import io.swagger.annotations.Api;
import java.util.Date;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/**
 * 提供本人测试使用
 * @author qinze
 *
 */
@Deprecated
@Api(description = "【测试】拉新用户逻辑", tags = "拉新用户逻辑接口")
@RestController
@RequestMapping("coupon/v1/userPullNew")
public class UserPullNewControllerTest extends BaseController{
    @Autowired
    private UserPullNewService userPullNewService;
    /**
     * 给拉新者赠送优惠（每次领用赠送） 登录到时候调用
     * @return
     */
    @GetMapping(value = "pull")
    public ReturnData<?> pull(){
	    	UserRelationDto userRelationDto = new UserRelationDto();
	    	userRelationDto.setCoverUserId(500L);
	    	userRelationDto.setUserId(400l);
    		UserRelation userRelation = new UserRelation();
		userRelation.setActivationTime(new Date());
		userRelation.setRegisterTime(new Date());
		userRelation.setCoverUserId(userRelationDto.getCoverUserId());
		userRelation.setUserId(userRelationDto.getUserId());
		userPullNewService.inserUserPullNew(userRelation);
         return  new ReturnData<>();
    }
    
    /**
     * 累计拉新配置(老用户赠送优惠卷) 支付时候调用
     * @return
     */
    @GetMapping(value = "accumulativePullNewConfig")
    public ReturnData<?> accumulativePullNewConfig(){
		userPullNewService.accumulativePullNewConfig(500);
         return  new ReturnData<>();
    }
}
